var Element = require('./Element');
var ClassList = require('./ClassList');
var FakeDomElement = require('./FakeDomElement');
var globalOptions = require('./globalOptions');
var globalState = require('./globalState');
var NativeNode = function () {
};
NativeNode.prototype = Object.create(Element.prototype, {
    constructor: {
        value: NativeNode,
        writable: true,
        configurable: true
    }
});
var d = NativeNode._advancedCreate = function (e, t) {
    var i = new NativeNode();
    i.is = e.toLowerCase();
    var d = null;
    'dom' === globalOptions.documentBackend && (d = globalState.backendExtractedDefault ? new FakeDomElement(e) : document.createElement(e));
    Element.initialize(i, d, t);
    i.classList = ClassList.create(i, null);
    if (t) {
        var A = t.__wxHost;
        i.classList._setOwnerOptions(A.classList, A.__componentOptions.classPrefix, A.__componentOptions.addGlobalClass);
        globalOptions.writeExtraInfoToAttr && d && d.setAttribute('exparser:info-class-prefix', A.__componentOptions.classPrefix && A.__componentOptions.classPrefix + '--');
    }
    return i;
};
NativeNode.create = function (e) {
    return d(e, null);
};
var A = NativeNode._advancedClone = function (e, t) {
    var i = new NativeNode();
    i.is = e.is;
    var d = null;
    e.__domElement && (d = e.__domElement instanceof FakeDomElement ? globalState.backendExtractedDefault ? e.__domElement.cloneNode() : FakeDomElement.toElement(e.__domElement) : globalState.backendExtractedDefault ? FakeDomElement.fromElement(e.__domElement) : document.importNode ? document.importNode(e.__domElement, false) : e.__domElement.cloneNode(false));
    Element._clone(i, e, d, t);
    i.classList = ClassList.create(i, null);
    if (t) {
        var A = t.__wxHost;
        i.classList._setOwnerOptions(A.classList, A.__componentOptions.classPrefix, A.__componentOptions.addGlobalClass);
        globalOptions.writeExtraInfoToAttr && d && d.setAttribute('exparser:info-class-prefix', A.__componentOptions.classPrefix && A.__componentOptions.classPrefix + '--');
    }
    return i;
};
NativeNode.cloneNode = function (e) {
    return A(e, null);
};
module.exports = NativeNode;
